<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="app">
    <!--
        响应式：
        当数据发生变化时,(使用该数据的地方)模板上直接或者间接使用该数据的地方都会发生变化。
    -->
    <p>msg:{{ msg }}</p>
    <input type="button" value="修改" @click="changeMsg">
    <br />
    <ul>
      <li v-for="item in books">{{ item }}</li>
    </ul>
    <input type="button" value="添加一本书" @click="addBook">
  </div>
  <script src="./js/vue.js"></script>
  <script>
    let vm = new Vue({
      el: "#app",
      data: {
        msg: "hello ",
        books: ["大学", "中庸"]
      },
      methods: {
        changeMsg() {
          this.msg += "1";
        },
        addBook() {
          this.books.push("论语");
        }
      }
    })
  </script>
</body>

</html>